package com.jse.jakarta;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashSet;
import java.util.Set;

import com.jse.Fs;
import com.jse.Jse;

import jakarta.websocket.Endpoint;
import jakarta.websocket.server.ServerApplicationConfig;
import jakarta.websocket.server.ServerEndpointConfig;

public class JseWebSocket implements ServerApplicationConfig {
	
	@Override
	public Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<? extends Endpoint>> endpointClasses) {
		Set<ServerEndpointConfig> ws=new HashSet<ServerEndpointConfig>();
		Jse.run(Jse.class,false);
		var path=Path.of(Jse.jspath(),"ws");
		if(Files.exists(path)) {
			Fs.paths(path, 0).forEach(p->{
				System.out.println("ws:"+p);
			});
		}
		return ws;
	}

    @Override
    public Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> results) {
        return results;
    }
}
